export default{
	methods:{
		async RepairSearchNewPartAsync(){
			let uPhone = this.UserInfo.mobile;
			let token = this.UserInfo.RetId;
			let custProductGuid = this.prodItemObj.proCustProdID;
			let productGuid = this.prodItemObj.ProuctId;
			let custProductPurchaseDate = this.prodItemObj.PurchaseDate;
			let isCustProductConfirmed = this.prodItemObj.IsProductConfirmed;
			let WOGUID = this.orderDetailId;
			let partsKeyWord = this.partsKeyWord;
			// let partsKeyWord = "090009970530";
			// debugger
			let {
				RetBool,
				RetObject,
				RetMsg
			} = await this.workordercompleteservice
				.RepairSearchNewPartAsync(uPhone, custProductGuid, productGuid,
					custProductPurchaseDate, isCustProductConfirmed, partsKeyWord, WOGUID,token);
			if (RetBool) {
				//console.log(JSON.parse(RetObject))
				return RetObject? JSON.parse(RetObject) : []
			} else
				throw RetMsg || "api出错"
		},
		async RepairSearchOldPartAsync() {
			let uPhone = this.UserInfo.mobile;
			let token = this.UserInfo.RetId;
			let custProductGuid = this.prodItemObj.proCustProdID;
			let productGuid = this.prodItemObj.ProuctId;
			let custProductPurchaseDate = this.prodItemObj.PurchaseDate;
			let isCustProductConfirmed = this.prodItemObj.IsProductConfirmed;
			let partsKeyWord = this.partsKeyWord;
			let {
				RetBool,
				RetObject,
				RetMsg
			} = await this.workordercompleteservice
				.RepairSearchOldPartAsync(uPhone, custProductGuid, productGuid,
					custProductPurchaseDate, isCustProductConfirmed, partsKeyWord, token)
			console.log("test");
			console.log(RetBool,RetObject,RetMsg);
			if (RetBool) {
				//console.log(JSON.parse(RetObject))
				return RetObject? JSON.parse(RetObject) : []
			} else
				throw RetMsg || "api出错"
			uni.hideLoading()
		},
		
		loadBase64Img(base64Img) {
			return `data:image/jpeg;base64,${base64Img}`;
		},
		
		async GetPartImg(imageIds) {
			if (imageIds.length > 0) {
				let uPhone = this.UserInfo.mobile;
				let token = this.UserInfo.RetId;
				let result = await this.commService.ImageReaderAsync(uPhone, imageIds, 1, token);
				if (result.RetBool && result.RetObject) {
					return JSON.parse(result.RetObject)
				}
				return [] ;
			}
			return []
		},
		
	}
}